import request from '@/config/axios'

// 班级学生关联 VO
export interface ExamClassStudentVO {
  id: number // 主键ID
  classId: number // 班级ID
  studentId: number // 学生ID
  studentNo: string // 学号
  studentName: string // 学生姓名
  phone: string // 联系电话
  email: string // 邮箱
  joinTime: Date // 加入时间
  status: number // 状态
}

// 班级学生关联 API
export const ExamClassStudentApi = {
  // 查询班级学生关联分页
  getExamClassStudentPage: async (params: any) => {
    return await request.get({ url: `/system/exam-class-student/page`, params })
  },

  // 查询班级学生关联详情
  getExamClassStudent: async (id: number) => {
    return await request.get({ url: `/system/exam-class-student/get?id=` + id })
  },

  // 新增班级学生关联
  createExamClassStudent: async (data: ExamClassStudentVO) => {
    return await request.post({ url: `/system/exam-class-student/create`, data })
  },

  // 修改班级学生关联
  updateExamClassStudent: async (data: ExamClassStudentVO) => {
    return await request.put({ url: `/system/exam-class-student/update`, data })
  },

  // 删除班级学生关联
  deleteExamClassStudent: async (id: number) => {
    return await request.delete({ url: `/system/exam-class-student/delete?id=` + id })
  },

  // 导出班级学生关联 Excel
  exportExamClassStudent: async (params) => {
    return await request.download({ url: `/system/exam-class-student/export-excel`, params })
  },

  // 根据班级ID获取学生列表
  getStudentListByClass: async (classId: number) => {
    return await request.get({ url: `/system/exam-class-student/list-by-class?classId=${classId}` })
  },

  // 导入班级学生
  importExamClassStudent: async (data) => {
    return await request.upload({ url: `/system/exam-class-student/import`, data })
  },

  // 下载班级学生导入模板
  importTemplate: async () => {
    return await request.download({ url: `/system/exam-class-student/get-import-template` })
  },
}
